package com.winit.openapi.chinapost.constants;

/**
 * 
 * <Change to the actual description of this class>
 * 
 * @version <pre>
 * Author   Version     Date        Changes
 * zhengbo.huang    1.0         2015-4-14   Created
 * 
 * </pre>
 * @since 1.
 */
public class ChinaMsgType {
    //出库成功：
    public static String LOGISTICS_SEC_DISPATCHED = "LOGISTICS_SEC_DISPATCHED";
    //出库失败：
    public static String LOGISTICS_SEC_NO_DISPATCHED = "LOGISTICS_SEC_NO_DISPATCHED";
    
    //入库成功
    public static String TRADE_WAREHOUSE_ENTRY="TRADE_WAREHOUSE_ENTRY";
    //入库失败
    public static String TRADE_WAREHOUSE_NO_ENTRY="TRADE_WAREHOUSE_NO_ENTRY";
    
    
    public static String TRADE_WAREHOUSE_PICKEDUP="TRADE_WAREHOUSE_PICKEDUP";
    
    public static String TRADE_WAREHOUSE_NO_PICKEDUP="TRADE_WAREHOUSE_NO_PICKEDUP";
    
    //清关成功
    public static String LOGIS_CUSTOMS_CLR = "LOGIS_CUSTOMS_CLR";
    //清关失败
    public static String LOGIS_CUSTOMS_CLR_FAIL = "LOGIS_CUSTOMS_CLR_FAIL";
    
    //退货接口
    private static String LOGISTICS_PACKAGE_REFUND="LOGISTICS_PACKAGE_REFUND";
    
    //清关成功status
    public static String LOGIS_CUSTOMS_CLR_STATUS = "清关成功";
    
    //客户揽收确认反馈 
    public static String LOGISTICS_CUS_RETURN_ADDRESS = "LOGISTICS_CUS_RETURN_ADDRESS";
    //中邮异常 
    public static String EXCEPTION_ORDER = "EXCEPTION_ORDER";
    //中邮异常处理
    public static String EXCEPTION_ORDER_HANDLE = "EXCEPTION_ORDER_HANDLE";
    
    //清关成功status
    public static String LOGIS_CUSTOMS_CLR_FAIL_STATUS = "清关失败";

    public static final String      MSG_SOURCE     = "CP";

    public static final String      BUSI_TYPE      = "ISP";
    
    public static final String      CHINAPOST_ACCEPT_ENCRYPTION_KEY      = "ChinaPost_accept_encryption_Key";
        
    /**
     * 
     * 中邮揽收/签收处理常数
     */
    public class ReceiveOrPick4CP {
        // 签收成功接口
        public static final String TRADE_WAREHOUSE_RECEIVE      = "TRADE_WAREHOUSE_RECEIVE";
        // 签收失败接口
        public static final String TRADE_WAREHOUSE_RECEIVE_FAIL = "TRADE_WAREHOUSE_RECEIVE_FAIL";
        // 揽收成功接口
        public static final String TRADE_WAREHOUSE_PICKEDUP     = "TRADE_WAREHOUSE_PICKEDUP";
        // 揽收失败接口
        public static final String TRADE_WAREHOUSE_NO_PICKEDUP  = "TRADE_WAREHOUSE_NO_PICKEDUP";
        // 收货类型---签收
        public static final String CHINA_POST_PICK_TYPE_SG      = "SG";
        // 收货类型---签收失败
        public static final String CHINA_POST_PICK_TYPE_RCP      = "RCP";
        // 收货类型---揽收
        public static final String CHINA_POST_PICK_TYPE_PU      = "PU";
        // 收货类型---揽收失败
        public static final String CHINA_POST_PICK_TYPE_CPPF      = "CPPF";
        // 揽收审核类型：去揽收
        public static final String CHINA_POST_APPROVE_SUC		= 	"01";
        // 揽收审核类型：不去揽收
        public static final String CHINA_POST_APPROVE_FAIL		=	"02";
    }
        
    /**
     * 是否是出库接口
     * @param msgType
     * @return
     */
    public static boolean ifDispatchedAPI(String msgType) {
        if (LOGISTICS_SEC_DISPATCHED.indexOf(msgType) > -1 || LOGISTICS_SEC_NO_DISPATCHED.indexOf(msgType) > -1) {
            return true;
        }
        return false;
    }
    
    /**
     * 是否是入库接口
     * 
     * @param msgType
     * @return
     */
    public static boolean isStorage(String msgType) {
        if (TRADE_WAREHOUSE_ENTRY.indexOf(msgType) > -1 ||TRADE_WAREHOUSE_NO_ENTRY.indexOf(msgType)>-1) {
            return true;
        }
        return false;
    }
    /**
     * 是否是清关接口
     * 
     * @param msgType
     * @return
     */
    public static boolean ifClrAPI(String msgType) {
        if (LOGIS_CUSTOMS_CLR.indexOf(msgType) > -1 || LOGIS_CUSTOMS_CLR_FAIL.indexOf(msgType) > -1) {
            return true;
        }
        return false;
    }
    
    /**
     * 是否是签收接口
     * 
     * @param msgType
     * @return
     */
    public static boolean isSignAPI(String msgType) {
        if (ReceiveOrPick4CP.TRADE_WAREHOUSE_RECEIVE.equals(msgType)
            || ReceiveOrPick4CP.TRADE_WAREHOUSE_RECEIVE_FAIL.equals(msgType)) {
            return true;
        }
        return false;
    }
    /**
     * 是否是揽收接口
     * 
     * @param msgType
     * @return
     */
    public static boolean isPickUp(String msgType) {
        if (ReceiveOrPick4CP.TRADE_WAREHOUSE_PICKEDUP.equals(msgType)
            || ReceiveOrPick4CP.TRADE_WAREHOUSE_NO_PICKEDUP.equals(msgType)) {
            return true;
        }
        return false;
    }
    
    /**
     * 退货接口
     * @param msgType
     * @return
     */
    public static boolean ifReturnAPI(String msgType){
        if(LOGISTICS_PACKAGE_REFUND.indexOf(msgType)>-1){
            return true;
        }
        return false;
    }
    
    /**
     * 客户揽收确认反馈接口
     * @param msgType
     * @return
     */
    public static boolean ifCusReturnAddress(String msgType){
        if(LOGISTICS_CUS_RETURN_ADDRESS.indexOf(msgType)>-1){
            return true;
        }
        return false;
    }
    public static boolean ifExOrder(String msgType){
        if(EXCEPTION_ORDER.indexOf(msgType)>-1){
            return true;
        }
        return false;
    }
    public static boolean ifExOrderHandle(String msgType){
        if(EXCEPTION_ORDER_HANDLE.indexOf(msgType)>-1){
            return true;
        }
        return false;
    }
    
}
